#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	int n = 0, arr[105] = { 0 };
	scanf("%d", &n);
	int i = 0, max = 0, number = 0, sum = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &number);
		arr[i] = number;
		if (number > max)
		{
			max = number;
		}
	}
	for (i = 0; i < n; i++)
	{
		if (arr[i] == max)
			continue;
		else
			sum += arr[i];
	}
	printf("%d", sum);
	return 0;
}
